"""
URL configuration for Django_Langchain_RAG project.

The `urlpatterns` list routes URLs to views_pak. For more information please see:
    https://docs.djangoproject.com/en/5.0/topics/http/urls/
Examples:
Function views_pak
    1. Add an import:  from my_app import views_pak
    2. Add a URL to urlpatterns:  path('', views_pak.home, name='home')
Class-based views_pak
    1. Add an import:  from other_app.views_pak import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""

from django.contrib import admin
from django.urls import path, include, re_path
from django.views.static import serve

from . import settings
from django.conf.urls.static import static
from . import views
import os

urlpatterns = [
    path("admin/", admin.site.urls),

    path('file/', include('file.urls_pak')),

    path('', views.home, name='home'),

    path('chat/', include('chat.urls')),
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
    urlpatterns += [
        re_path(
            r'^chat/Data/(?P<path>.*)$',
            serve,
            {'document_root': os.path.join(settings.BASE_DIR, 'Data')}
        )
    ]
